package br.com.pucrs.tcc.ed;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

@Entity
@Table(name = "AREAS_INTERESSE")
public class AreaInteresse implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 5942853001726003682L;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name = "ID")
	private Integer id;

	@Column(name = "NOME")
	private String nome;

	@Column(name = "COD_GRUPO")
	private String codGrupo;

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "PROFESSORES_AREAS_INTERESSE", joinColumns = { @JoinColumn(name = "AREAS_INTERESSE_ID") }, inverseJoinColumns = { @JoinColumn(name = "PROFESSORES_MATRICULA") })
	private List<Professor> professores;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public String getCodGrupo() {
		return codGrupo;
	}

	public void setCodGrupo(String codGrupo) {
		this.codGrupo = codGrupo;
	}

	public List<Professor> getAreasInteresse() {
		return professores;
	}

	public void setProfessores(List<Professor> professores) {
		this.professores = professores;
	}

	public AreaInteresse() {

	}

	public AreaInteresse(Integer id) {
		this.id = id;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}
		if (obj instanceof AreaInteresse) {
			AreaInteresse area = (AreaInteresse) obj;
			return this.id.equals(area.id);
		}
		return false;
	}

}
